/*
 * OperationLayer.h
 *
 *  Created on: 2010-12-15
 *      Author: wenjian
 */

#ifndef OPERATIONLAYER_H_
#define OPERATIONLAYER_H_

#include "WorkPage.h"
#include "RadioButton.h"
#include "RadioGroup.h"
#include "Label.h"
#include "../../commons.h"
#include "../../gdiplus/gdraw.h"
#include <event/EventListener.h>
using namespace Ed;
using namespace Thk;
namespace S {
  //class RadioListener;
  /**
   * 参数操作设置层
   */
  class OperationLayer: public Ed::Layer {
    public:
      OperationLayer(WorkPage* page);
      virtual ~OperationLayer();




    private:
      RadioGroup radioGroup;
      RadioButton* ilMergerRadio; //ImageLayerMerger
      RadioButton* blMergerRadio; //BitbltLayerMerger
      RadioButton* tblMergerRadio; //TransparentBitbltLayerMerger

      Label* ilLabel;
      Label* blLabel;
      Label* tblLabel;
    public:

    /**
     * 选择模式按钮事件监听器
     */
    class RadioListener : public Thk::EventListener{
      public:
        RadioListener(OperationLayer* l, WorkPage* page)
        :operationLayer(l), page(page){}
        virtual ~RadioListener(){}

        virtual bool handle(const Thk::Event* e){
          RadioButton* rb = (RadioButton*)e->getSource();
          if(rb->isChecked()){
            if(rb == operationLayer->ilMergerRadio){
              page->switchToImageLayerMerger();
            }else if(rb == operationLayer->blMergerRadio){
              page->switchToBitbltLayerMerger();
            }else{
              page->switchToTransparentBitbltLayerMerger();
            }
          }

          return false;
        }
      private:
        OperationLayer* operationLayer;
        WorkPage* page;

    };
    private:
      RadioListener* radioListener;
  };

}

#endif /* OPERATIONLAYER_H_ */
